#ifndef COMPONENTMANAGER_H
#define COMPONENTMANAGER_H


#include "ComponentFactory.h"
#include "Component.h"

#include "PropertyManager.h"

#include <string>
#include <map>

#include "../lib/tinyXML/tinyxml.h"

class ComponentArguments;
class Component;
class ComponentFactory;



class ComponentManager: public PropertyManager
{
    public:
        ComponentManager();
        virtual ~ComponentManager();


        void createComponent(std::string _name, ComponentArguments _cArgs);
        void removeComponent(std::string _name);
        Component* getComponent(std::string _name);
        bool hasComponent(std::string _name);

        void initializeAllComponents();


         void saveToXML(TiXmlElement* parentElement);
         void loadFromXML(TiXmlElement* parentElement);

        void update(double timeSinceLastFrame);




    protected:
    private:

    ComponentFactory* m_componentFactory;

    std::map<std::string, Component*> m_components;

};

#endif // COMPONENTMANAGER_H
